import requests
from bs4 import BeautifulSoup
import time

url = "http://120.24.224.148/"
headers = {"User-Agent": "Mozilla/5.0"}

try:
    response = requests.get(url, headers=headers)
    response.raise_for_status()  # 检查请求是否成功
    soup = BeautifulSoup(response.text, "lxml")
    
    # 提取书籍价格
    prices = []
    for price in soup.select("div.product_price p.price_color"):
        prices.append(price.get_text())
    
    print("提取到的价格：", prices)
    time.sleep(1)  # 避免高频请求

except requests.exceptions.RequestException as e:
    print("请求异常：", e)